package com.cirnoworks.guice;

import javax.inject.Singleton;

import com.google.inject.spi.InjectionListener;

@Singleton
class LifeCycleInjectionListener implements InjectionListener<LifeCycle> {

	private LifeCycleService service;

	LifeCycleInjectionListener(LifeCycleService service) {
		this.service = service;
	}

	@Override
	public void afterInjection(LifeCycle injectee) {
		service.register(injectee);
		injectee.startup();
	}

}